-
-
Notifications
You must be signed in to change notification settings - Fork 223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TASK: document and assert Node.nodeName behavior #4469
Conversation
Sadly phpstan doenst allow us to annotate this behavior ... https://phpstan.org/writing-php-code/narrowing-types#custom-type-checking-functions-and-methods And also the feature like in
playground: |
Neos.ContentRepository.Core/Classes/Projection/ContentGraph/Node.php
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for defensive style (even though people will probably not instantiate this class manually) because it makes invalid states impossible.
In the long run we will hopefully be able to remove NodeName
and NodeType
from the Node
read model, and can remove the checks then.
Neos.ContentRepository.Core/Classes/Projection/ContentGraph/Node.php
Outdated
Show resolved
Hide resolved
Neos.ContentRepository.Core/Classes/Projection/ContentGraph/Node.php
Outdated
Show resolved
Hide resolved
af8d6e3
to
9328330
Compare
Neos.ContentRepository.Core/Classes/Projection/ContentGraph/Node.php
Outdated
Show resolved
Hide resolved
Neos.ContentRepository.Core/Classes/Projection/ContentGraph/Node.php
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just two mini tweaks, +1 apart from those
Hmm but now our ProjectionIntegrityViolationDetection fails: Line 42 in d614486
because of this (enabled) Line 176 in 52be2f0
A hack would be to disable it temporary? |
What is the root cause? Can't we fix that (e.g. adjust the test such that it does not create an invalid node)? |
as far as i understand is that we test that if a the database projection has an invalid node (somehow) we detect it. |
674ef8b
to
1e6bf9d
Compare
yes after adjusting the catch up the tests pass. The neos.neos catchup is registers itself here into the default preset neos-development-collection/Neos.Neos/Configuration/Settings.ContentRepositoryRegistry.yaml Lines 18 to 21 in cc4a0a6
and since we use the content repository registry in Line 164 in a177872
we get everything registered for the default cr for free ;) this is partially a good thing as we fully e2e test everything (at least that stuff generally works) but might also cause trouble like when doctrine is not setup but a projection needs it or it might slow down tests. |
1e6bf9d
to
328e308
Compare
Neos.ContentRepository.BehavioralTests/Tests/Behavior/Bootstrap/FeatureContext.php
Outdated
Show resolved
Hide resolved
otherwise it's basically impossible now to reproduce the state, as publishing an event will lead to the catchup's to run, which might instantiate a node: the neos.neos `GraphProjectorCatchUpHookForCacheFlushingFactor` catchUpHook would fail for example: > When the event NodeAggregateWithNodeWasCreated was published with payload: > # Features/ProjectionIntegrityViolationDetection/TetheredNodesAreNamed.feature:41 > InvalidArgumentException: The NodeName must be set if the Node is tethered.
328e308
to
cd8408c
Compare
…lication::publishEvent ... where its impossible to infer types
Thanks for all your input today. Inspired from some other tests in the doctrine dbal adapter: To modifying the db directly to provoke this invalid state, i moved the test over there and did the same ;) see cd8408c hopefully this can now be finally merged :D Didnt expect this to blow up that much :P |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one, thanks!
Thank you all for the extensive discussion last Friday (@kitsunet @bwaidelich @nezaniel) and sorry for hijacking that weekly partly for this non critical thing :D Im happy that this is older task of mine is now resolved ;) |
related #4311
When looking into the php node readmodel it should be super clear that a nodename is guaranteed to be set if its tethered.
Upgrade instructions
Review instructions
Checklist
FEATURE|TASK|BUGFIX
!!!
and have upgrade-instructions